package com.ruoyi.system.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Date;


@Data
@TableName("tz_collection_order")
@ApiModel(description = "催款订单信息表")
public class TzCollectionOrder {

    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键id")
    private Long id;

    @TableField("tenant_id")
    @ApiModelProperty(value = "租户编号")
    private String tenantId;

    @TableField("out_order_id")
    @ApiModelProperty(value = "甲方订单ID")
    private String outOrderId;

    @TableField("out_order_no")
    @ApiModelProperty(value = "甲方订单编号")
    private String outOrderNo;

    @TableField("product_name")
    @ApiModelProperty(value = "产品名称")
    private String productName;

    @TableField("product_info")
    @ApiModelProperty(value = "产品信息Json")
    private String productInfo;

    @TableField("customer_name")
    @ApiModelProperty(value = "还款人姓名")
    private String customerName;

    @TableField("mobile")
    @ApiModelProperty(value = "联系电话")
    private String mobile;

    @TableField("address")
    @ApiModelProperty(value = "联系地址")
    private String address;

    @TableField("id_card")
    @ApiModelProperty(value = "身份证号码")
    private String idCard;

    @TableField("id_card_front")
    @ApiModelProperty(value = "身份证正面照片")
    private String idCardFront;

    @TableField("id_card_back")
    @ApiModelProperty(value = "身份证反面照片")
    private String idCardBack;

    @TableField("total_amount")
    @ApiModelProperty(value = "订单总金额")
    private BigDecimal totalAmount;

    @TableField("repaid_amount")
    @ApiModelProperty(value = "已还款金额")
    private BigDecimal repaidAmount;

    @TableField("unpaid_amount")
    @ApiModelProperty(value = "未还款金额")
    private BigDecimal unpaidAmount;

    @TableField("total_periods")
    @ApiModelProperty(value = "订单总期数")
    private Integer totalPeriods;

    @TableField("repaid_periods")
    @ApiModelProperty(value = "已还款期数")
    private Integer repaidPeriods;

    @TableField("unpaid_periods")
    @ApiModelProperty(value = "未还款期数")
    private Integer unpaidPeriods;

    @TableField("repayment_plan")
    @ApiModelProperty(value = "还款计划信息json")
    private String repaymentPlan;

    @TableField("contract_url")
    @ApiModelProperty(value = "合同地址")
    private String contractUrl;

    @TableField("risk_report_url")
    @ApiModelProperty(value = "风控报告地址")
    private String riskReportUrl;

    @TableField("order_status")
    @ApiModelProperty(value = "订单状态(0-待还款 1-部分还款 2-已逾期 3-已结清)")
    private Integer orderStatus;

    @TableField("overdue_days")
    @ApiModelProperty(value = "逾期天数")
    private Integer overdueDays;

    @TableField("user_id")
    @ApiModelProperty(value = "催收人ID")
    private Long userId;

    @TableField("collection_status")
    @ApiModelProperty(value = "催收状态(0-待催收 1-催收中 2-承诺还款 3-催收成功 4-催收失败)")
    private Integer collectionStatus;

    @TableField("collection_times")
    @ApiModelProperty(value = "催收次数")
    private Integer collectionTimes;

    @TableField("last_collection_time")
    @ApiModelProperty(value = "最后催收时间")
    private Date lastCollectionTime;

    @TableField("settlement_amount")
    @ApiModelProperty(value = "结清金额")
    private BigDecimal settlementAmount;

    @TableField("collection_remark")
    @ApiModelProperty(value = "催收备注")
    private String collectionRemark;

    @TableField("create_dept")
    @ApiModelProperty(value = "创建部门")
    private Long createDept;

    @TableField("del_flag")
    @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
    @TableLogic(delval = "2",value = "0")
    private String delFlag;

    @TableField("create_by")
    @ApiModelProperty(value = "创建者")
    private String createBy;

    @TableField("create_time")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @TableField("update_by")
    @ApiModelProperty(value = "更新者")
    private String updateBy;

    @TableField("update_time")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @TableField("remark")
    @ApiModelProperty(value = "备注")
    private String remark;


    @TableField("type")
    @ApiModelProperty(value = "逾期类型 1-手机租赁逾期, 2-E卡商城逾期, 4-黄金分期逾期, 5-卡卷红包逾期, 6-融单逾期")
    private String type;


    public static void main(String[] args) throws Exception {
        ObjectMapper objectMapper = new ObjectMapper();
        ObjectNode jsonNode = objectMapper.createObjectNode();

        // 获取TzCollectionOrder类的所有字段
        Field[] fields = TzCollectionOrder.class.getDeclaredFields();

        for (Field field : fields) {
            // 获取字段上的ApiModelProperty注解
            ApiModelProperty annotation = field.getAnnotation(ApiModelProperty.class);
            if (annotation != null) {
                // 获取注解的value属性
                String comment = annotation.value();
                // 将字段名和注释添加到JSON对象中
                jsonNode.put(field.getName(), comment);
            }
        }

        // 将JSON对象转换为字符串并打印
        String jsonString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode);
        System.out.println(jsonString);
    }
}
